﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using ExamDemo.Models;

namespace ExamDemo.Data
{
    public class DataInitializer : DropCreateDatabaseIfModelChanges<ExamDemoDb>
    {
        protected override void Seed(ExamDemoDb db)
        {
            db.Users.AddRange(new List<Users>
            {
                new Users
                {
                    Username="aaaa",
                    Password="aa"
                }
            });

            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="wsasdfw"
                },new Messages
                {
                    FromUserId=1,
                    Content="dffff"
                },new Messages
                {
                    FromUserId=1,
                    Content="wwwwd"
                },new Messages
                {
                    FromUserId=1,
                    Content="hhhhh"
                }
            });


            db.Comments.AddRange(new List<Comments>
            {
                   new Comments
                {
                    FromUserId=1,
                    MsgId=2,
                    Comment="jjjaa"
                },new Comments
                {
                    FromUserId=1,
                    MsgId=1,
                    Comment="aklfajljf"
                },
            });



            db.SaveChanges();


            base.Seed(db);
        }
    }
}